/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package models;

// tbv Internationalisatie
import java.util.*;
import java.text.*;
import models.User;


public class Bean {
    private static String language;
    private Locale currentLocale;
    private String country;
    private ResourceBundle message;
    private String key;
    private NumberFormat currencyFormatter;
    private DateFormat dateFormatter;
    private double amount;

    public Bean(){
        setLanguage("nl");
        setAmount("123.0");
    }
    
    public void setLanguage(String l){
        language = l; 
        currentLocale = new Locale(language);
        message = java.util.ResourceBundle.getBundle(language);
    }
    
    public static String getLanguage(){
        return language;
    }

    public void setKey(String key) {
        this.key = key;
    }
    
    public String getKey(){
        return message.getString(key);
    }
    
    public void setAmount(String s){
        try{
            currentLocale = new Locale(country);
            //country = models.User.getCountry();
            amount = Double.parseDouble(s);
            currencyFormatter = NumberFormat.getCurrencyInstance(currentLocale);
            dateFormatter = DateFormat.getDateInstance(DateFormat.LONG,
					   currentLocale);
        }
        catch(Exception e) {
            System.out.println(e.getMessage());
        }
        
    }

    public String getAmount(){
        return currencyFormatter.format(amount);
    }
}